#include<bits/stdc++.h>
using namespace std;

int main()
{
    int arr[]={9,2,9,4,9,6,9,8};
    int start = 0;
    int end = sizeof(arr)/sizeof(arr[0])-1;
    while(start+1<end)
    {
        if(arr[start]%2!=0)
        {
            start++;
        }
        if(arr[end]%2==0)
        {
            end--;
        }
        int temp = arr[start];
        arr[start] = arr[end];
        arr[end] = temp;
        start++;
        end--;
    }
    for(int i = 0;i< sizeof(arr)/sizeof(arr[0]);i++)
    {
        cout<<arr[i]<<"\t";
    }
}